const app = getApp()
Page({
  /**
   * 页面的初始数据
   **/
  data: {
    userInfo: null,
  },
  /*
  * 生命周期函数--监听页面加载
  */
  onLoad: function (options) {
    let that = this;
    //判断用户是否登录
    let userInfo = app.globalData.userInfo;
    if (userInfo) {
      this.setData({
        userInfo: userInfo,
      })
    } else {
      wx.getUserInfo({
        success: function (res) {
          that.setData({
            userInfo: res.userInfo
          })
        }
      })
    }
  }
})